package com.trkj.dao.jpa;

import java.util.Date;
import java.util.List;

import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.trkj.pojos.LmbMaterialStorage;

public interface LmbMaterialStorageDAO extends CrudRepository<LmbMaterialStorage, String> {
	@Query("select max(c.msId) from LmbMaterialStorage c where c.msId like ?1%")
    public String findMaxID(String a);
	
	//根据入库单号查询入库信息
	@Query("select ms from LmbMaterialStorage ms where ms.msId =?1")
	public LmbMaterialStorage findMaterialStorage(String msId);
	
	//查询所有的入库记录
	@Query("select ms from LmbMaterialStorage ms")
	public List<LmbMaterialStorage> findAllMaterialStorage(Pageable pageable);
	
	//统计所偶有入库记录条数
	@Query("select count(*) from LmbMaterialStorage ms")
	public long countAllMaterialStorage();
	
	@Query("select ms from LmbMaterialStorage ms where ms.msDate between ?1 and ?2")
	public List<LmbMaterialStorage> findMaterialStorageByDate(Pageable pageable,Date ksrq,Date jsrq);
}
